package ui.panels.messageBox;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;

import ui.flowManager.FlowManagerImpl;

/**
 * @author vladimir && alon
 *
 *	Frame for errors and warnings messages
 */
public class MessageBoxFrame extends JFrame{

	private String message = "Error";
	
	/**
	 * CTOR
	 * @param message
	 */
	public MessageBoxFrame ()
	{
		super();
		
		//set the frame
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        setSize(300,250);
        setResizable(false);
        //This will center the JFrame in the middle of the screen
        setLocationRelativeTo(null);
        setVisible(true);
        
        //Disable the the primary GUI
        FlowManagerImpl.getInstance().setEnable(false);
        
        //set listener to close
        addWindowListener(new WindowEventHandler());
	}
	
	/**
	 * @author vladimir && alon
	 *
	 */
	private class WindowEventHandler extends WindowAdapter {
		  public void windowClosing(WindowEvent evt) { 
		    //set enable the primary GUI
			 FlowManagerImpl.getInstance().setEnable(true);
		  }
	}

	
}
